package com.copc.common.util;

import com.copc.common.constants.SystemStatusEnum;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.annotations.ApiResponses;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础返回类
 * @author
 *
 */
@Component
@Data
@NoArgsConstructor
public class ResultCommon<T> implements Serializable{

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "交易流水号",required = true)
	private String transactionNo;

	@ApiModelProperty(value = "响应代码" )
	private String respCode;

	@ApiModelProperty(value = "响应消息" )
	private String respMessage;

	@ApiModelProperty(value = "响应时间" )
	private Date respTime;

	@ApiModelProperty(value = "响应内容" )
	private T content;



	public ResultCommon(SystemStatusEnum systemStatusEnum){
		this.respCode = systemStatusEnum.code();
		this.respMessage = systemStatusEnum.message();
	}
	public ResultCommon(SystemStatusEnum systemStatusEnum,String transactionNo,Date respTime){
		this.respCode = systemStatusEnum.code();
		this.respMessage = systemStatusEnum.message();
		this.respTime = respTime;
		this.transactionNo = transactionNo;
	}

	public ResultCommon(String respCode,String respMessage){
		this.respCode = respCode;
		this.respMessage = respMessage;
	}

	public ResultCommon(String respCode,String respMessage,T content){
		this.respCode = respCode;
		this.respMessage = respMessage;
		this.content = content;
	}

	public ResultCommon(String respCode,String respMessage,T content,Date respTime){
		this.respCode = respCode;
		this.respMessage = respMessage;
		this.content = content;
		this.respTime = respTime;
	}

	public ResultCommon(String respCode,String respMessage,T content,Date respTime,String transactionNo){
		this.respCode = respCode;
		this.respMessage = respMessage;
		this.content = content;
		this.respTime = respTime;
		this.transactionNo = transactionNo;
	}
}
